package com.riip.demos.elasticjob.service;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;

/**
 * @program: demos
 * @description:
 * @author: 刘振华
 * @create: 2020-03-17 16:25
 **/

public class MyJob implements SimpleJob {
	@Override
	public void execute(ShardingContext shardingContext) {
		System.out.println(String.format("------Thread ID: %s, 任務總片數: %s, " +
				"当前分片項: %s.当前參數: %s," +
				"当前任務名稱: %s.当前任務參數: %s,ThreadName:%s"
			,
			Thread.currentThread().getId(),
			shardingContext.getShardingTotalCount(),
			shardingContext.getShardingItem(),
			shardingContext.getShardingParameter(),
			shardingContext.getJobName(),
			shardingContext.getJobParameter(),
			Thread.currentThread().getName()

		));
	}
}
